<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>立即申请</title>

    <!-- styles here -->
    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../css/Public_CSS.css">
    <link rel="stylesheet" href="../css/mui.min.css">
    <link rel="stylesheet" href="../css/style.css">
</head>

<body>
    <div id="app" class="apply-page">
        <div class="banner-back">
            <span onclick="window.history.back()">
                <i>返回</i>
            </span>立即申请
        </div>
        <div class="scroll-y">
            <div class="form-group">
                <label>身份证号</label>:
                <input type="text" v-model="datas.idCard" placeholder="请填写您的身份证号">
            </div>
            <div class="form-group">
                <label>姓名</label>:
                <input type="text" v-model="datas.username" placeholder="请填写您身份证上的姓名">
            </div>
            <div class="form-group">
                <label>手机号</label>:
                <input type="text" v-model="datas.phone" placeholder="请填写您的手机号">
            </div>
            <div class="form-group">
                <label>所在区县</label>:
                <input type="text" v-model="datas.address" placeholder="请选择所在区县">
            </div>
            <div class="form-group">
                <label>所在市</label>:
                <input type="text" v-model="datas.city" placeholder="成都">
            </div>
            <div class="form-group">
                <label>单位名称</label>:
                <input type="text" v-model="datas.companyName" placeholder="请填写单位名称">
            </div>
            <div class="form-group">
                <label>单位地址</label>:
                <input type="text" v-model="datas.companyAddress" placeholder="请填写单位地址">
            </div>
            <div class="agreement">
                <i>&radic;</i>
                <input type="checkbox" v-model="agree" onclick=" toggleActived()">
                <a href="./authorization-agreement2.html">我接受 用户使用协议</a>
            </div>
            <div>
                <button @click="apply">提交</button>
            </div>
        </div>
    </div>

    <!-- scripts here -->
    <script type="text/javascript" src="../js/main.js"></script>
    <script src="../js/common.js" type="text/javascript"></script>
    <script src="../js/jquery.min.js" type="text/javascript"></script>
    <script src="../js/vue.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../public/js/loan/mui.min.js"></script>
    <script>
        $(function () {
            vm.datas['card'] = sessionStorage.getItem("card");
            vm.datas['company'] = sessionStorage.getItem("company");
            vm.datas['edu'] = sessionStorage.getItem("edu");
            vm.datas['house'] = sessionStorage.getItem("house");
            vm.datas['social'] = sessionStorage.getItem("social");
            vm.datas['work'] = sessionStorage.getItem("work");
            vm.datas['workProve'] = sessionStorage.getItem("workProve");
            vm.datas['cardMoney'] = sessionStorage.getItem("cardMoney");
            vm.datas['appId'] = appId();
        });
        var vm = new Vue({
            el: "#app",
            data: {
                datas: {},
                agree: false,
            },
            methods: {
                apply: function () {
                    if (!vm.agree) {
                        mui.alert("请先阅读并同意协议");
                        return;
                    }
                    $.ajax({
                        url: '/thmlfApi/avs/yb/accessLoan',
                        type: "POST",
                        contentType: "application/json",
                        data: JSON.stringify(vm.datas),
                        dataType: "JSON",
                        success: function (r) {
                            if (r.code == 200) {
                                mui.alert("申请提交成功！\n请等候工作人员审核通知。", null, null, function () {
                                    window.location.href = "index.html?appId=" + appId();
                                });
                            } else
                                alert(r.message);
                        },
                        error: function (e) {
                            console.log("request error", e);
                            mui.alert("请求失败，请稍后重试");
                        }
                    })
                }
            }
        });
    </script>
</body>

</html>